﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Com.Framework;
using Com.Framework.Data;
using Com.Library.Page;
using Com.Library.DB.Advertise;
using Com.Web.coffinegurunaru.AppLogic.Page;
using Com.Web.coffinegurunaru.AppLogic;

namespace Com.Web.coffinegurunaru.manager.advertise
{
	public partial class advertisemethod : ManagerAjaxPage
	{
		public string[] GetList(int CategoryNo, int PageNo, byte PageSize)
		{
			ListData<AdvertiseEntity, OutputEntity> result = AdvertiseModel.GetList(CategoryNo, PageNo, PageSize);
			string[] retValue = new string[3];
			Dictionary<string, object> properties = new Dictionary<string, object>();
			properties.Add("AdvertiseList", result.Record);
			retValue[0] = ViewManager<ManagerPage>.Render("/manager/advertise/list.ascx", properties);
			retValue[1] = result.Output.CntTotal.ToString();
			retValue[2] = result.Output.CntRow.ToString();
			return retValue;
		}

		public string GetInfo(int AdvertiseNo)
		{
			AdvertiseEntity info = AdvertiseModel.GetInfo(AdvertiseNo);

			string retValue = string.Empty;
			Dictionary<string, object> properties = new Dictionary<string, object>();
			
			properties.Add("AdvertiseInfo", info);
			if (info.CategoryNo == 1)
				retValue = ViewManager<ManagerPage>.Render("/manager/advertise/info_cf.ascx", properties);
			if (info.CategoryNo == 2)
				retValue = ViewManager<ManagerPage>.Render("/manager/advertise/info_ppl.ascx", properties);
			if (info.CategoryNo == 3)
				retValue = ViewManager<ManagerPage>.Render("/manager/advertise/info_paper.ascx", properties);
			if (info.CategoryNo == 4)
				retValue = ViewManager<ManagerPage>.Render("/manager/advertise/info_etc.ascx", properties);
			return retValue;
		}

		public void CreateCF(string Title, string ListTitle, string ThumbURL, byte MovieType, string FlashURL, string MovieURL, string HTML, string Content)
		{
			AdvertiseCreateArguments arg = new AdvertiseCreateArguments();
			arg.n4CategoryNo = 1;
			arg.strTitle = Title;
			arg.strListTitle = ListTitle;
			arg.strThumbURL = ThumbURL;
			arg.n1MoveType = MovieType;
			arg.strFlashURL = FlashURL;
			arg.strMovieURL = MovieURL;
			arg.strHTML = HTML;
			arg.strContent = Content;
			arg.strManagerName = this.WebCookies.ManagerName;
			AdvertiseModel.Create(arg);
		}

		public void ModifyCF(int AdvertiseNo, string Title, string ListTitle, string ThumbURL, byte MovieType, string FlashURL, string MovieURL, string HTML, string Content)
		{
			AdvertiseModifyArguments arg = new AdvertiseModifyArguments();
			arg.n4AdvertiseNo = AdvertiseNo;
			arg.strTitle = Title;
			arg.strListTitle = ListTitle;
			arg.strThumbURL = ThumbURL;
			arg.n1MoveType = MovieType;
			arg.strFlashURL = FlashURL;
			arg.strMovieURL = MovieURL;
			arg.strHTML = HTML;
			arg.strContent = Content;
			arg.strManagerName = this.WebCookies.ManagerName;
			AdvertiseModel.Modify(arg);
		}

		public void CreatePPL(string Title, string ListTitle, string ImageURL, string ThumbURL, string Content)
		{
			AdvertiseCreateArguments arg = new AdvertiseCreateArguments();
			arg.n4CategoryNo = 2;
			arg.strTitle = Title;
			arg.strListTitle = ListTitle;
			arg.strThumbURL = ThumbURL;
			arg.strImageURL = ImageURL;
			arg.strContent = Content;
			arg.strManagerName = this.WebCookies.ManagerName;
			AdvertiseModel.Create(arg);
		}

		public void ModifyPPL(int AdvertiseNo, string Title, string ListTitle, string ImageURL, string ThumbURL, string Content)
		{
			AdvertiseModifyArguments arg = new AdvertiseModifyArguments();
			arg.n4AdvertiseNo = AdvertiseNo;
			arg.strTitle = Title;
			arg.strListTitle = ListTitle;
			arg.strThumbURL = ThumbURL;
			arg.strImageURL = ImageURL;
			arg.strContent = Content;
			arg.strManagerName = this.WebCookies.ManagerName;
			AdvertiseModel.Modify(arg);
		}

		public void CreatePaper(string Title, string ListTitle, string ImageURL, string ThumbURL, string Content)
		{
			AdvertiseCreateArguments arg = new AdvertiseCreateArguments();
			arg.n4CategoryNo = 3;
			arg.strTitle = Title;
			arg.strListTitle = ListTitle;
			arg.strThumbURL = ThumbURL;
			arg.strImageURL = ImageURL;
			arg.strContent = Content;
			arg.strManagerName = this.WebCookies.ManagerName;
			AdvertiseModel.Create(arg);
		}

		public void ModifyPaper(int AdvertiseNo, string Title, string ListTitle, string ImageURL, string ThumbURL, string Content)
		{
			AdvertiseModifyArguments arg = new AdvertiseModifyArguments();
			arg.n4AdvertiseNo = AdvertiseNo;
			arg.strTitle = Title;
			arg.strListTitle = ListTitle;
			arg.strThumbURL = ThumbURL;
			arg.strImageURL = ImageURL;
			arg.strContent = Content;
			arg.strManagerName = this.WebCookies.ManagerName;
			AdvertiseModel.Modify(arg);
		}

		public void CreateEtc(string Title, string ListTitle, string ImageURL, string ThumbURL, string Content, string Image2URL, string Image3URL)
		{
			AdvertiseCreateArguments arg = new AdvertiseCreateArguments();
			arg.n4CategoryNo = 4;
			arg.strTitle = Title;
			arg.strListTitle = ListTitle;
			arg.strThumbURL = ThumbURL;
			arg.strImageURL = ImageURL;
			arg.strImage2URL = Image2URL;
			arg.strImage3URL = Image3URL;
			arg.strContent = Content;
			arg.strManagerName = this.WebCookies.ManagerName;
			AdvertiseModel.Create(arg);
		}

		public void ModifyEtc(int AdvertiseNo, string Title, string ListTitle, string ImageURL, string ThumbURL, string Content, string Image2URL, string Image3URL)
		{
			AdvertiseModifyArguments arg = new AdvertiseModifyArguments();
			arg.n4AdvertiseNo = AdvertiseNo;
			arg.strTitle = Title;
			arg.strListTitle = ListTitle;
			arg.strThumbURL = ThumbURL;
			arg.strImageURL = ImageURL;
			arg.strImage2URL = Image2URL;
			arg.strImage3URL = Image3URL;
			arg.strContent = Content;
			arg.strManagerName = this.WebCookies.ManagerName;
			AdvertiseModel.Modify(arg);
		}

		public void Remove(int AdvertiseNo)
		{
			AdvertiseModel.Remove(AdvertiseNo);
		}
	}
}
